package net.comm.message.db;


import java.sql.ResultSet;
import java.sql.SQLException;


import net.comm.message.bean.BaseMessage;
import net.comm.message.bean.BaseMsgcont;
import net.comm.user.bean.BaseContacts;
import net.comm.util.StringUtil;

import org.apache.log4j.Logger;
import org.sakaiproject.db.api.SqlReader;

public class DbMsgcontService implements SqlReader
{

	static Logger logger = Logger.getLogger(DbMsgcontService.class.getName());

	/**
	 * Read from the result one set of fields to create a Resource.
	 * 
	 * @param result
	 *        The Sql query result.
	 * @return The Resource object.
	 */
	public Object readSqlResultRecord(ResultSet result)
	{
		try
		{
			
			int  msgID = result.getInt(1);									//消息序号
			String  msg = StringUtil.getValue(result.getString(2));			//消息
			String  mTime = StringUtil.getValue(result.getString(3));		//最后修改日期

			// create the Resource from these fields
			return new BaseMsgcont( msgID,  msg, mTime );
		}
		catch (SQLException e)
		{
			logger.error("取记录失败！");
			return null;
		}
		
	}
}
